$(function() {
	//	初始化scroll控件
	mui('.mui-scroll-wrapper').scroll({
		deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
	});

	//轮播
	var gallery = mui('.mui-slider');
	gallery.slider({
		interval: 5000 //自动轮播周期，若为0则不自动播放，默认为0；
	});



});
//地址栏截图
//window.address = 'http://www.vimi66.com/green';
window.address = 'http://192.168.1.199';
//window.address = 'http://www.leyouhui888.cn';

window.CD = {};
CD.geturl = function() {
	var params = {};
	var search = location.search;
	if(search) {
		search = search.replace('?', '');
		var arr = search.split('&');
		arr.forEach(function(item, i) {
			var itemArr = item.split('=');
			params[itemArr[0]] = itemArr[1];
		})
	};
	return params;
}
//console.log(CD.geturl().id,999)

//点击跳转事件
function ldClick(addr) {
	window.location.href = addr;
}


/**
 * 将"2018-05-19T08:04:52.000+0000"这种格式的时间转化为正常格式
 * @param time
 */
function timeFormat(time) {
    var d = new Date(time);
 
    var year = d.getFullYear();       //年  
    var month = d.getMonth() + 1;     //月  
    var day = d.getDate();            //日  
 
    var hh = d.getHours();            //时  
    var mm = d.getMinutes();          //分  
    var ss = d.getSeconds();           //秒  
 
    var clock = year + "/";
 
    if (month < 10)
        clock += "0";
 
    clock += month + "/";
 
    if (day < 10)
        clock += "0";
 
    clock += day + " ";
 
    if (hh < 10)
        clock += "0";
 
    clock += hh + ":";
    if (mm < 10) clock += '0';
    clock += mm + ":";
 
    if (ss < 10) clock += '0';
    clock += ss;
    return (clock);
    
}


function getParam(paramName) {   
	paramValue = "", isFound = !1;   
	if(this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {     
		arrSource = unescape(this.location.search).substring(1,
			this.location.search.length).split("&"), i = 0;     
		while(i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 &&
			arrSource[i].split("=")[0].toLowerCase() ==                 paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++       
	}   
	return paramValue == "" && (paramValue = null), paramValue 
} ;




function setCookie(name,value,hours,path){ 
    var name = escape(name); 
    var value = escape(value); 
    var expires = new Date(); 
    expires.setTime(expires.getTime() + hours*3600000); 
    path = path == "" ? "" : ";path=" + path; 
    _expires = (typeof hours) == "string" ? "" : ";expires=" + expires.toUTCString(); 
    document.cookie = name + "=" + value + _expires + path; 
} 
//获取cookie值    方法
function getCookieValue(name){ 
    var name = escape(name); 
    //读cookie属性，这将返回文档的所有cookie 
    var allcookies = document.cookie;        
    //查找名为name的cookie的开始位置 
    name += "="; 
    var pos = allcookies.indexOf(name);     
    //如果找到了具有该名字的cookie，那么提取并使用它的值 
    if (pos != -1){                                             //如果pos值为-1则说明搜索"version="失败 
        var start = pos + name.length;                  //cookie值开始的位置 
        var end = allcookies.indexOf(";",start);        //从cookie值开始的位置起搜索第一个";"的位置,即cookie值结尾的位置 
        if (end == -1) end = allcookies.length;        //如果end值为-1说明cookie列表里只有一个cookie 
        var value = allcookies.substring(start,end);  //提取cookie的值 
        return unescape(value);                           //对它解码       
        }    
    else return "";                                             //搜索失败，返回空字符串 
}
